package com.xlh.enums.cs;

import com.xlh.exception.common.GlobalException;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

/**
 * @author zhr 2019/10/17
 */
@Getter
@AllArgsConstructor
public enum CourseSystemTypeEnum {
    SYSTEM_COURSE(1, "系统课程"),
    NOT_SYSTEM_COURSE(2, "非系统课程");

    private Integer type;
    private String message;

    public static CourseSystemTypeEnum getType(Integer type) {
        for (CourseSystemTypeEnum courseSystemTypeEnum : CourseSystemTypeEnum.values()) {
            if (Objects.equals(type, courseSystemTypeEnum.getType())) {
                return courseSystemTypeEnum;
            }
        }
        throw new GlobalException("不识别的类型");
    }
}
